import {Interaction} from './interaction.interface'
import { DomService } from '../dom.service'
import imgCompressor from '../clz/imgCompress'
export class AndroidService implements Interaction{
	private dom: DomService = new DomService()
	private window: any = this.dom.window
	login() {
		return new Promise((resolve,reject) => {
			resolve('asd')
		})
	}
	quit(){
		this.window.android.ksdBack();
	}
	getcamera(type?:string) { //type 0拍照 1图库 2全部
		return this.window.android.controlImageGetType_js(type);
	}
	getRequestHeader(){}
	compressImage(options:{
		path:string,
		success:Function
	}){
		console.log('and---------------')
		const compressor = new imgCompressor();
		compressor.compressByFile(options.path).then((res:any) => {
			options.success({
				tempFilePath:res
			})
		})
	}
	
}